<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <script src="/libs/react.development.js"></script>
    <script src="/libs/react-dom.development.js"></script>
    <script src="/libs/babel.min.js"></script>
    <title>Document</title>
  </head>
  <body>
    <div id="root"></div>
    <script type="text/babel">
      class Demo extends React.Component {
        myref = React.createRef();
        render() {
          return (
            <div>
              <input ref={this.myref} type="text" placeholder="点击按钮提示" />
              <button onClick={this.showmsg}>按钮</button>
            </div>
          );
        }
        showmsg = () => {
          alert(this.myref.current.value);
        };
      }
      ReactDOM.render(<Demo />, document.getElementById("root"));
    </script>
  </body>
</html>
